<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>定时跳转</title>
		<style>
			body {
				color: red;
				font-size: 25px;
			}
		</style>
	</head>

	<body>
		<h2 align="center">提交成功</h2>
		<p align="center"><a href="http://www.runoob.com" >
			<span id="sec">5</span>秒后系统自动跳转，也可以单击此连接跳转</p>
		</a>
		<script type="text/javascript">
			/*1、数字递减
						  2、当数字到0时、跳转到某个URL*/
			var number = 5;
			var span = document.getElementById('sec')

			function jian() {
				if(number > 0) {
					number--;
					span.innerHTML = number
				} else {
					//清除计时器，跳转
					clearInterval(jian)
					location.href="http://www.baidu.com"
				}
			}
			var timer = window.setInterval(jian, 1000);
		</script>
	</body>

</html>